Data

Kriddie was here! again!

Import data

In this document we are going to calculate Evasion from the Vaisala Sensors and compare them to the eosFD flux measurements as well as see how they relate to other variables such as precipitation and temperature. First we import the data and for now we will filter so we are looking at non-injections

Create new time variables for ease of plotting

These new variables will help us plot each seperate day on a timescale of midnight -> midnight

df$day <- as.factor(substr(as.character(df$DateTime),1,10))
times <- substr(as.character(df$DateTime),12,16)
df$time <- strftime(df$DateTime, format="%H:%M")
df$time <- ymd_hm(paste0("2019-07-01-",df$time))

todayStart <- ymd_hms(paste0(Sys.Date(),"00:00:00"))
todayEnd <- ymd_hms(paste0(Sys.Date(),"23:59:59"))

CO2 Change

Change in CO2

The first step in calculating flux from the stream is to calculate change in CO2 concentrations between two points within the stream. We will look at two pairs of sensors (1->3 & 3->4). Once we determine change in CO2 concentration, we will convert ppm to uMols and then account for stream metabolism (respiration and photosynthesis) to calculate flux. First, let’s visualize change in CO2 accross the pairs of sensors

So now that we know what the change in CO2 between stations, it’s time to account for stream metabolism. Stream metabolism includes Ecosystem Respiration (ER) and Gross Primary Production / phtosynthesis (GPP). Both of these processes include a 1:1 exchange of CO2 and DO molecules. Photosynthesis: Use CO2 and create O2 (1:1 ratio).

Respiration: Use O2, create CO2 (1:1 ratio).

Respiration can occur in the abscence of sunlight while photosynthesis cannot. At night, stream processes are respiration driven. During the day both respiration and photosynthesis occur. We can look at the changes in DO over the similar stretches of stream and time period. We did not have a DO sensor at station 3 but we did have one at station 2.

Dissolved Oxygen

Change in Dissolved Oxygen

Mass Conversion

Convert CO2 from concentration to mass

Now that we know the change in CO2 in terms of concentration (ppm), we can convert it to mass. Specifically, we will take this opportunity to convert to micromoles (uMols), which we will eventually use to express evasion.

# Distances are 17,30,80

filt13$uMols_13 <- ((filt13$V1-filt13$V3)/ 37.6) *.0018*(1000000/44.01)*filt13$stn1_Q/1000 

filt34$uMols_34 <- ((filt34$V3-filt34$V4)/ 64) *.0018*(1000000/44.01)*filt34$stn3_Q/1000

Plotting data

Histograms of change in CO2

CO2 Change over time

May or may not use this plot, if so, needs to be cleaned up.

Change in CO2 (umols)

Evasion Using Daily Stream Metabolism

Using the USGS streammetabolizer package, daily estimates of GPP and ER can be calculated at each of the DO sensor locations. This is done in a seperate script located in: ‘Ecuador/Analysis/Stream_Metabolism/metabolism.R’. The results are used to estimate daily evasion for the reach. The values expressed in the results of the streammetabolizer tool are grams of O2 / m^2 /d^-1. We need to convert this into uMols and then multiply by -1 to determine uMols CO2.

Estimate daily ER and GPP in uMols of CO2

1 mole of CO2 = 31.9988 grams.

Average ER and GPP Values for Stations 1 & 2

We average the GPP and ER values at station 1 & 2 for use with change in CO2 between station 1 and 3. We use GPP and ER estimates from station 4 for the change in CO2 between stations 3 and 4.

stn12 <- metabCO2%>%
  filter(Station < 4)%>%
  group_by(DateTime)%>%
  mutate(GPP_CO2uMol12 = mean(GPP_CO2uMol),
         ER_CO2uMol12 = mean(ER_CO2uMol))%>%
  ungroup()

stn4 <- metabCO2%>%
  filter(Station == 4)%>%
  mutate(GPP_CO2uMol34 = GPP_CO2uMol,
         ER_CO2uMol34 = ER_CO2uMol)

metabCO2avg <- left_join(stn12,stn4, by="date")

Evasion Calculations

Convert CO2 Change into Daily Values

DCO2Daily13 <- filt13%>%
  group_by(day)%>%
  mutate(DailyChange13 = mean(uMols_13*86400))%>%
  select(day,DailyChange13)%>%
  distinct()%>%
  rename("date"="day")

DCO2Daily <- filt34%>%
  group_by(day)%>%
  mutate(DailyChange34 = mean(uMols_34*86400))%>%
  select(day,DailyChange34)%>%
  distinct()%>%
  rename("date"="day")%>%
  left_join(DCO2Daily13, by="date")

Merge ‘Daily Change’ with stream metabolism to get metabolism adjusted evasion

Check to see if \(CO_{2}\) change is the same as adjusting for Metabolism

Date Change_1-3 Evasion_1-3 Pct_Dif_1-3 Change_3-4 Evasion_3-4 Pct_Dif_3-4
2019-07-13 292541.73 376053.8 -22.207485 2475684 2533236 -2.2718834
2019-07-15 62451.08 144695.7 -56.839728 3322024 3338553 -0.4950891
2019-07-18 179053.11 256811.4 -30.278376 2126519 2119143 0.3481063
2019-07-20 156282.86 223852.4 -30.184850 2572747 2563919 0.3443412
2019-07-21 161063.32 235219.5 -31.526374 2669804 2781430 -4.0132316
2019-07-27 149210.92 208472.5 -28.426575 2202602 2287693 -3.7195107
2019-07-28 169928.44 244184.5 -30.409807 2047427 2126164 -3.7032655
2019-08-07 241938.94 309789.1 -21.902046 1701860 2033803 -16.3212967
2019-08-10 218582.25 267548.2 -18.301739 1577666 1617938 -2.4891229
2019-08-11 219932.74 264110.7 -16.727078 1581424 1620721 -2.4246634
2019-08-12 265222.95 312024.9 -14.999431 1640288 1775144 -7.5968828
2019-08-13 213839.46 224999.9 -4.960198 1783588 1784164 -0.0322726
## Warning: Ignoring 19 observations

Daily Evasion & Metabolism in µmol

As μmols m2s-1

As moles m2d-1

As moles m2d-1

Compare with eoSense chamber

## Warning: Ignoring 14 observations

## Warning: Ignoring 14 observations

Try integrating to get daily estimates of flux from eos

Here we integrate instead of using the daily average and compare to see if they are different.

eosInt <- df%>%
  filter(Inj == "No")%>%
  select(DateTime,Flux_1,day)

complete <- eosInt[complete.cases(eosInt), ]
  
integrate <- complete%>%
  arrange(DateTime)%>%
  mutate(Interval = DateTime - lag(DateTime),
         FluxInt = Flux_1 * Interval*60/1000000)%>%
  group_by(day)%>%
  mutate(DailyFluxInt = sum(FluxInt))%>%
  select(day,DailyFluxInt)%>%
  ungroup()%>%
  distinct()%>%
  mutate(day = ymd(day))


join <- left_join(eos,integrate)
## Joining, by = "day"
join <- join[complete.cases(join),]
join$Date <- seq(1,nrow(join))

join%>%
  plot_ly()%>%
  add_segments(x=0,y=0,xend=.25,yend=.25)%>%
  add_markers(x = ~DailyFlux, y = ~DailyFluxInt, color = ~Date,
              hoverinfo = "text",
              text = ~paste("Integrated: ", DailyFluxInt, " [mol m<sup>-2</sup>d<sup>-1</sup>]<br>",
                            "Daily Average: ", DailyFlux, " [mol m<sup>-2</sup>d<sup>-1</sup>]<br>",
                            "Date: ", day))%>%
  layout(xaxis = list(title = "Daily Average"),
         yaxis = list(title = "Integrated Daily"))

X/Y